The present invention relates to a program detection technique for nonvolatile semiconductor memory devices. In the program detection of a NAND flash memory as an example of nonvolatile semiconductor memory devices, programming and first detections are repeated a predetermined number of times until programming of the memory cells to be written in a page is completed (loop 1). When programming is not completed after a predetermined number of programming, a second detection is performed that takes into consideration a failure relief due to a redundant region.
The second detection detects the number of failures in a page or in a unit of correction (segment) due to the redundant region, during a time period in which programming and the confirmation of a threshold value for the memory cells are not performed. Programming is ended when the number of failures is within an allowable range. Programming is performed again when the number of failures is equal to or greater than the allowable number.
However, because the programming and detection concurrently proceeds in the first detection, the passing of detection always accompanies one extra unnecessary programming. This can be prevented by setting a smaller value for the predetermined number, so that the programming does not end in the first detection. However, in this case, the sequence must return to the loop 1 if the second detection is not passed. This increases the number of detections and accordingly increases program time.